package org.springframework.test.mapper;

import org.springframework.annotation.core.Repository;
import org.springframework.annotation.mybatis.*;
import org.springframework.test.entity.User;

@Mapper
public interface UserMapper {
    @Select("select * from user where id = #{id}")
    User select(@Param("id") int id);

    @Insert("insert into user values(default, #{username}, #{password})")
    int insert(@Param("username") String username, @Param("password") String password);

    @Update("update user set password = #{password} where id = #{id}")
    int update(@Param("id") int id, @Param("password") String password);

    @Delete("delete from user where id = #{id}")
    int delete(@Param("id") int id);
}
